Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sindresorhus/is

Package Overview
Dependencies
Maintainers
1
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sindresorhus/is

Type check values

  • 4.6.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is @sindresorhus/is?

The @sindresorhus/is npm package is a type-checking library that provides a variety of functions to assert the type of a given value. It can be used to check primitive types, built-in objects, and to perform environment checks.

What are @sindresorhus/is's main functionalities?

Primitive type checking

Check if a value is a string.

const is = require('@sindresorhus/is');
console.log(is.string('Hello World')); // true

Built-in object checking

Check if a value is a Promise.

const is = require('@sindresorhus/is');
console.log(is.promise(new Promise(resolve => resolve()))); // true

Environment checking

Check if the current environment is Node.js.

const is = require('@sindresorhus/is');
console.log(is.nodejs); // true or false depending on the environment

Array checking

Check if a value is an Array.

const is = require('@sindresorhus/is');
console.log(is.array([1, 2, 3])); // true

Object checking

Check if a value is an Object.

const is = require('@sindresorhus/is');
console.log(is.object({foo: 'bar'})); // true

Other packages similar to @sindresorhus/is

Keywords

FAQs

Package last updated on 27 Feb 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc